import requestApi from "../utils/request";

let base_url = "http://localhost:3000/api"


//用户名和密码登录
export const UserLoginApi = (user_name, user_password) => {
        return requestApi(base_url + "/user/login", {
            user_name,
            user_password
        }, "post")
    }
    //获取短信验证码
    //http://localhost:3000/api/user/sendcode
    //post
    //phone

export const getPhoneCodeApi = (url, params, type) => {
    return requestApi(base_url + url, params, type)
}




//短信登录接口
//post
//http://localhost:3000/api/user/phonelogin
//code
//captcha
//phone

export const phoneLoginApi = (url, params, type) => {
    return requestApi(base_url + url, params, type)
}

//首页列表
//代理的大商创的接口
let base_url2 = "/api"
export const getIndexListApi = (params) => {
    return requestApi(base_url2 + "/goods/type_list", params)
}

// 分类左侧
// https://x.dscmall.cn/api/catalog/list
export const getCategoryLeftApi = () => {
    return requestApi(base_url2 + "/catalog/list")
}

// 分类右侧
// https://x.dscmall.cn/api/catalog/list/858
export const getCategoryRightApi = (cat_id) => {
    return requestApi(base_url2 + "/catalog/list/" + cat_id)
}

// 分类列表
export const postCategoryListApi = (params) => {
    return requestApi(base_url2 + "/catalog/goodslist", params, "post")
}

// 品牌列表
export const postBrandListApi = (params) => {
    return requestApi(base_url2 + "/catalog/brandlist", params, "post")
}